#include "Util.h"
#include <sstream>
#include <fstream>

namespace SEngine
{
    std::string CreateUUID()
    {
        std::random_device rd;
        std::mt19937_64 gen(rd());
        std::uniform_int_distribution<uint64_t> dis;
    
        uint64_t part1 = dis(gen);
        uint64_t part2 = dis(gen);
    
        std::ostringstream oss;
        oss << std::hex << part1 << part2;
    
        std::string uuidStr = oss.str();
        return uuidStr.substr(0, 32); // 截取32位作为简化的UUID
    }

    std::string SEReadText(const std::string &fileName)
    {
        std::stringstream ss;
        std::ifstream file(fileName);
        if (file.is_open()) {
            ss << file.rdbuf();
        }
        return ss.str();
    }

    void SEWriteText(const std::string &fileName, const std::string &str)
    {
        std::ofstream file(fileName);
        if (file.is_open()) {
            file << str;
        }
    }

} // namespace SEngine
